package com.big.codegen.service.impl;

import com.big.codegen.domain.dto.CodegenTableConfigDTO;
import com.big.codegen.domain.dto.ColumnDTO;
import com.big.codegen.domain.entity.CodegenTableConfig;
import com.big.codegen.service.CodegenTableConfigService;
import com.big.common.mybatis.base.service.impl.BaseServiceImpl;
import com.google.common.collect.Lists;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 代码生成表配置Service实现类
 *
 * @author 山归岿
 * @create 2025-01-03
 */
@Slf4j
@Service
@RequiredArgsConstructor
public class CodegenTableConfigServiceImpl extends BaseServiceImpl<CodegenTableConfigDTO, CodegenTableConfig> implements CodegenTableConfigService {
    @Override
    public List<ColumnDTO> getCommonFields() {
        // 基于BaseEntity的通用字段
        return Lists.newArrayList(
                ColumnDTO.builder().columnName("create_time").columnComment("创建时间").columnType("DATETIME").columnDefault("CURRENT_TIMESTAMP").isNullable(false).build(),
                ColumnDTO.builder().columnName("update_time").columnComment("更新时间").columnType("DATETIME").columnDefault("CURRENT_TIMESTAMP").columnDefaultUpdate("CURRENT_TIMESTAMP").isNullable(false).build(),
                ColumnDTO.builder().columnName("create_by").columnLength(50).columnComment("创建人").columnType("VARCHAR").isNullable(true).build(),
                ColumnDTO.builder().columnName("update_by").columnLength(50).columnComment("更新人").columnType("VARCHAR").isNullable(true).build(),
                ColumnDTO.builder().columnName("del_flag").columnComment("是否删除：0-未删除，1-已删除").columnType("TINYINT").columnDefault("0").build()
        );
    }

}